<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><{:C('site_name')}></title>
<meta name="keywords" content="<{:C('keyword')}>" />
<meta name="description" content="<{:C('content')}>" />
<link rel="stylesheet" href="<{:STATICS}>/css/bootstrap.min.css" type="text/css" media="all" />
<link rel="stylesheet" href="<{:STATICS}>/uploadify/uploadify.css" type="text/css"/>
</head>
<script type="text/javascript" src="<{:STATICS}>/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="<{:STATICS}>/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<{:STATICS}>/js/jquery.artDialog.js?skin=aero"></script>
<script type="text/javascript" src="<{:STATICS}>/js/iframeTools.js"></script>
<script type="text/javascript" src="<{:STATICS}>/js/jquery.form.min.js"></script>
<script type="text/javascript" src="<{:STATICS}>/uploadify/jquery.uploadify.min.js"></script>

<script type="text/javascript">
$(document).ready(function() {
	$("#face").uploadify({		
		swf      : '<{:STATICS}>/uploadify/uploadify.swf',
		uploader : '<{:U("Avatar/save")}>',
		height : 30, //按钮高度
		widht : 120, //按钮宽度
		fileTypeDesc : 'Image File', //选择文件提示文字
		fileTypeExts : '*.jpeg; *.jpg; *.png; *.bmp; *.gif; *.swf',
		onUploadSuccess : function(file,data,response) {//上传完成时触发（每个文件触发一次）
		　　var responseText=eval('('+data+')');
			if(responseText.state == 'SUCCESS'){
				$('#img').html("<{:C('UPLOAD_PATH')}>"+responseText.url);
				returnHomepage(responseText.url);				
			}else{
				alert(responseText.state);
			}
		}
	})
});

var domid=art.dialog.data('domid');
// 返回数据到主页面
function returnHomepage(url){
	url = <{:C('UPLOAD_PATH')}> + 'avatar/' + url ;
	var origin = artDialog.open.origin;
	origin.document.getElementById(domid).src=url;
	setTimeout("art.dialog.close()", 100 )
}
</script>
<body>
<form>
	<table width=100% style="margin-top:30px;">
		<tr>
			<td align="right" width=100 height=50>&nbsp;</td><td align="left">Click the button below to select the file</td>
		</tr>
		<tr>
			<td align="right" height=50></td><td align="left"><input type="file" name="face" id="face" /> <button class="btn btn-defatult" onclick="art.dialog.close()">Close</button></td>
		</tr>
	</table>
	<input type="hidden" name="imgurl" id="imgurl" value="" />	
</form>
</body>
</html>
